package com.seven.first.suite.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LocalDateUtil {

    private static DateTimeFormatter yyyyMMddHHmmss
            = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    private static DateTimeFormatter yyyyMMdd
            = DateTimeFormatter.ofPattern("yyyy-MM-dd");

    public static String formatyyyyMMddHHmmss(LocalDateTime time) {
        return time.format(yyyyMMddHHmmss);
    }

    public static LocalDateTime parseyyyyMMddHHmmss(String time) {
        return LocalDateTime.parse(time, yyyyMMddHHmmss);
    }

    public static String formatyyyyMMdd(LocalDateTime time) {
        return time.format(yyyyMMdd);
    }

    public static LocalDateTime parseyyyyMMdd(String time) {
        return LocalDateTime.parse(time, yyyyMMdd);
    }
}
